package zy1208.zy9;

import java.lang.reflect.Field;

public class demo {
    public static void main(String[] args) throws Exception {
        Class<?> aClass = Class.forName("zy1208.zy9.student");
        Field name = aClass.getDeclaredField("name");
        Object o = aClass.newInstance();
        name.set(o,"小虎");
        Object o1 = name.get(o);
        System.out.println(o1);
        Field age = aClass.getDeclaredField("age");
        Object o2 = aClass.newInstance();
        age.set(o,25);
        Object o3 = age.get(o);
        System.out.println(o3);
    }
}
